package com.example.tests;

import static com.example.fw.RandomizeHelper.getRandomNumber;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

import org.testng.annotations.Test;

import com.example.utils.SortedListOf;

public class ContactRemovalTests extends TestBase
{
	@Test
	public void removeSomeContact()
	{
		SortedListOf<ContactData> oldList = app.getModel().getContacts();
		if (oldList.size() > 0)
		{
			int index = getRandomNumber(0, oldList.size() - 1);

			app.getContactHelper().deleteContact(index);

			SortedListOf<ContactData> newList = app.getContactHelper().getUIContacts();

			assertThat(newList, equalTo(oldList.without(index)));
		}
	}
}
